﻿using UnityEngine;

namespace GameDesigner
{
    public interface IAnimationHandler
    {
        /// <summary>
        /// 当状态机开始初始化
        /// </summary>
        /// <param name="stateMachine"></param>
        void OnInitializeBegin(IStateMachine stateMachine);
        /// <summary>
        /// 当状态机结束初始化
        /// </summary>
        /// <param name="stateMachine"></param>
        void OnInitializeEnd(IStateMachine stateMachine);
        /// <summary>
        /// 设置内部参数
        /// </summary>
        /// <param name="target"></param>
        void SetParams(params object[] args);
        /// <summary>
        /// 当播放动画方法
        /// </summary>
        /// <param name="state">当前状态</param>
        /// <param name="stateAction">当前动作</param>
        void OnPlayAnimation(State state, StateAction stateAction);
        /// <summary>
        /// 当动画每帧更新
        /// </summary>
        /// <param name="state">当前状态</param>
        /// <param name="stateAction">当前动作</param>
        /// <param name="currMode">当前所属某个执行模式</param>
        /// <returns>是否播放完成</returns>
        bool OnAnimationUpdate(State state, StateAction stateAction, StateMachineUpdateMode currMode);
        /// <summary>
        /// 当动画结束
        /// </summary>
        /// <param name="state"></param>
        /// <param name="stateAction"></param>
        void OnAnimationEnd(State state, StateAction stateAction);

        void ApplyLayerMask();
        /// <summary>
        /// 当状态进入
        /// </summary>
        /// <param name="state"></param>
        void OnStateEnter(State state);
        /// <summary>
        /// 当状态更新
        /// </summary>
        /// <param name="state"></param>
        /// <param name="currMode"></param>
        void OnStateUpdate(State state, StateMachineUpdateMode currMode);
        /// <summary>
        /// 当状态退出
        /// </summary>
        /// <param name="state"></param>
        void OnStateExit(State state);
        void ApplyLayerWeight(bool isCrossFade = true);
    }
}